﻿Public Partial Class frm_FindCustomer_Popup
    Inherits System.Web.UI.Page

    Dim clsGet As New ClassFunctionGetData
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            LoadData(Session("txtCUSCNDN") & "")
            Session("txtCUSCNDN") = Nothing
        End If
    End Sub

    Private Sub LoadData(ByVal Customer As String)
        Dim dtCus As DataSet = clsGet.Get_CustomerMaster(Customer)
        gridCustomer.DataSource = dtCus
        gridCustomer.DataBind()

    End Sub

    Private Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        LoadData(txtCustomer.Text)
    End Sub

    Private Sub btnClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClose.Click
        Session("Customer_NoCNDN") = ""
        ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(String), "myscript", " parent.closeModal('C');", True)
    End Sub

    Private Sub gridCustomer_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gridCustomer.RowCommand
        Dim Index As Integer = Convert.ToInt32(e.CommandArgument)
        If e.CommandName = "Edit" Then
            Session("Customer_NoCNDN") = gridCustomer.DataKeys(Index).Values("Customer_no") & ""
            ScriptManager.RegisterClientScriptBlock(Me.Page, GetType(String), "myscript", " parent.closeModal('C');", True)
        End If
    End Sub

    Private Sub gridCustomer_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles gridCustomer.RowEditing

    End Sub

    Private Sub MainPage_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit
        Dim ds As DataSet = Session("UserData")
        If Not (ds Is Nothing) Then
            Page.MasterPageFile = clsGet.GetMaster_Page(ds.Tables(0).Rows(0).Item("User_Name").ToString(), "")
        End If
    End Sub
End Class